<?php
/**
 * Created by PhpStorm.
 * User: wanglin
 * Date: 2018/9/11
 * Time: 11:34
 */

namespace App\Services\ThirdAPI;



use common\utils\RedisKeys;
use App\Models\Order;
use App\Models\AgPlaytypes;
use App\Models\AgGames;
use Illuminate\Support\Facades\Log;

class BGAPIService
{

    protected $apiName = "bg";


    /**
     * 拉取bg注单信息
     */
    public function getBGOrders($startTime, $endTime)
    {
        $result = [];//接收的数据
        $url = config('app.rpcserver') . "/api/getOrders";
        $data=[
            'api_name' => $this->apiName,
            'start_time' => $startTime,
            'end_time' => $endTime,
        ];
        Log::info("Bg视讯注单抓取接口请求url:====" . $url . "请求开始时间参数:".date("Y-m-d H:i:s",$startTime)  . "=请求结束时间:" . date("Y-m-d H:i:s",$endTime));
        $res = GameApiService::request($url, 'get', $data);
        $result=array_merge($result,$res);
        Log::info("Bg视讯注单抓取接口请求url:====" . $url . "请求参数:======" . json_encode($data, JSON_UNESCAPED_UNICODE) . "请求时间:====" . date("Y-m-d H:i:s") . "总共有" . count($result) . "条数据");
        amount_format_array($result,['bet_money','winloss_money','prize_money','valid_money','contribute_money','bonus_money'],true);
        return $result;
    }

    /**
     * 拉取bg注单信息
     */
    public function getTips($startTime, $endTime)
    {
        $result = [];//接收的数据
        $url = config('app.rpcserver') . "/api/getTips";
        $data=[
            'api_name' => $this->apiName,
            'startTime' => $startTime,
            'endTime' => $endTime,
        ];
        Log::info("Bg视讯小费抓取接口请求url:====" . $url . "请求开始时间参数:".date("Y-m-d H:i:s",$startTime)  . "=请求结束时间:" . date("Y-m-d H:i:s",$endTime));
        $res = GameApiService::request($url, 'get', $data);
        $result=array_merge($result,$res);
        Log::info("Bg视讯小费抓取接口请求url:====" . $url . "请求参数:======" . json_encode($data, JSON_UNESCAPED_UNICODE) . "请求时间:====" . date("Y-m-d H:i:s") . "总共有" . count($result) . "条数据");
        return $result;
    }

}